<?php
/**
 * 扩展的彩信发送客户端
 * @author kim007
 *
 */
class MmsClient{
	
	/**
	 * 网关地址
	 */
	var $url;
	
	/**
	 * 序列号,请通过亿美销售人员获取
	 */
	var $userName;
	
	/**
	 * 密码,请通过亿美销售人员获取
	 */
	var $password;
	
	/**
	 * 发送类型
	 */
	var $sendType;
	
	/**
	 * webservice客户端
	 */
	var $soap;

	/**
	 * 
	 */
	function MmsClient($gwUrl,$userName,$password,$sendType){
		$this->url 		= $gwUrl;
		$this->userName	= $userName;
		$this->password	= $password;
		$this->sendType	= $sendType;
		$this->soap=new SoapClient($this->url);
	}
	
	/**
	 * 彩信发送 
	 * 
	 * @param array $userNumbers	手机号, 如 array('159xxxxxxxx'),如果需要多个手机号群发,如 array('159xxxxxxxx','159xxxxxxx2') 
	 * @param string $MMSContent	彩信内容
	 * @param string $title 		彩信标题
	 * @return array 标准格式 参见emayParseResult
	 */
	function sendMms($title,$userNumbers,$MMSContent){
		$param['userName']=$this->userName;
		$param['password']=$this->password;
		$param['title']=$title;
		$param['userNumbers']=implode(',',$userNumbers);
		$param['MMSContent']=$MMSContent;
		$param['sendType']=$this->sendType;
		$return=$this->soap->__call('SendMMS',array('paramters'=>$param));
		$result = emayParseResult::sendMms($return->SendMMSResult);
		return $result;
	}
	
	
	function getBalance(){
		$param['userName']=$this->userName;
		$param['password']=$this->password;
		$param['sendType']=$this->sendType;
		$return=$this->soap->__call('GetMMSCount',array('paramters'=>$param));
		$result = emayParseResult::getBalanceMms($return->GetMMSCountResult);
		return $result;
	}
}

?>
